package hikari.preferences.scene_parameters;

import com.gooddies.texteditors.validation.AbstractValidator;
import hikari.gui.guicomponents.ColorPicker;
import hikari.persistence.file.FileSection;
import hikari.persistence.propertieseditor.editors.IPropertyEditor;
import java.io.IOException;
import javax.swing.JComponent;
import org.swig.jirr.SColor;

/**
 * @author Dmitry
 */
public class ColorPropertyEditor extends ColorPicker implements IPropertyEditor {

    @Override
    public Object getEditorValue() {
        return new SColor(getSelectedColor());
    }

    @Override
    public void setEditorValue(Object value) {
        if (value != null) {
            setSelectedColor((SColor) value);
        }
    }

    @Override
    public void setMax(Object max) {
        throw new UnsupportedOperationException("ColorPropertyEditor does not support max property");
    }

    @Override
    public void setMin(Object min) {
        throw new UnsupportedOperationException("ColorPropertyEditor does not support min property");
    }

    @Override
    public void setValidator(AbstractValidator validator) {
        throw new UnsupportedOperationException("ColorPropertyEditor does not support validator property");
    }

    @Override
    public void setMaxLength(String length) {
        throw new UnsupportedOperationException("ColorPropertyEditor does not support length property");
    }

    @Override
    public JComponent getJComponent() {
        return this;
    }

    @Override
    public void save(String fieldName, FileSection section) throws IOException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void read(String fieldName, FileSection section) throws IOException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
